package com.ljf.task.web;

import com.ljf.common.exception.ServiceException;
import com.ljf.common.result.ResultModel;
import com.ljf.common.validation.UpdateGroup;
import com.ljf.common.web.BasisController;
import com.ljf.task.dto.command.TaskDatTaskDetailStatusCommand;
import com.ljf.task.dto.command.TaskDatTaskTabulationCommand;
import com.ljf.task.dto.command.TaskDatTaskTabulationDesignCommand;
import com.ljf.task.dto.command.TaskDatTaskTabulationTaskStatusCommand;
import com.ljf.task.dto.query.TaskDatTaskTabulationQuery;
import com.ljf.task.service.ITaskDatTaskTabulationService;
import com.ljf.task.vo.TaskDatTaskTabulationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 任务列表  控制器
 *
 * @author LJF
 * @since 2024-12-25
 */
@RestController
@RequestMapping("/task/dat/task_tabulation")
@Api(value = "任务列表接口", tags = "任务列表接口")
public class TaskDatTaskTabulationController extends BasisController<ITaskDatTaskTabulationService, TaskDatTaskTabulationQuery, TaskDatTaskTabulationVO, TaskDatTaskTabulationCommand> {

    @PutMapping("/task_status")
    @ApiOperation(value = "更新任务状态接口")
    public ResultModel editTaskStatus(@RequestBody @Validated(UpdateGroup.class) TaskDatTaskTabulationTaskStatusCommand command) throws ServiceException {
        return service.editTaskStatus(command);
    }

    @PutMapping("/detail/draft")
    @ApiOperation(value = "更新任务明细草稿接口")
    public ResultModel editDetailDraft(@RequestBody @Validated(UpdateGroup.class) TaskDatTaskTabulationDesignCommand command) throws ServiceException {
        return service.editDetailDraft(command);
    }

    @PutMapping("/detail/final_draft")
    @ApiOperation(value = "更新任务明细终稿接口")
    public ResultModel editDetailFinalDraft(@RequestBody @Validated(UpdateGroup.class) TaskDatTaskTabulationDesignCommand command) throws ServiceException {
        return service.editDetailFinalDraft(command);
    }

    @PutMapping("/detail/develop_status")
    @ApiOperation(value = "更新任务明细开发状态接口")
    public ResultModel editDetailDevelopStatus(@RequestBody @Validated(UpdateGroup.class) TaskDatTaskDetailStatusCommand command) throws ServiceException {
        return service.editDetailDevelopStatus(command);
    }

    @GetMapping("/commit_message/{id}")
    @ApiOperation(value = "获取提交信息文本接口")
    public ResultModel queryCommitMessageById(@PathVariable Long id) throws ServiceException {
        return service.queryCommitMessageById(id);
    }

    @GetMapping("/design_message/{id}")
    @ApiOperation(value = "根据ID查询任务设计信息接口")
    public ResultModel queryDesignMessageById(@PathVariable Long id) throws ServiceException {
        return service.queryDesignMessageById(id);
    }

    @GetMapping("/develop_message/{id}")
    @ApiOperation(value = "根据ID查询任务开发信息接口")
    public ResultModel queryDevelopMessageById(@PathVariable Long id) throws ServiceException {
        return service.queryDevelopMessageById(id);
    }

    @GetMapping("/detail/submit_message/{id}")
    @ApiOperation(value = "根据ID查询任务开发提交内容接口")
    public ResultModel queryDetailSubmitMessageById(@PathVariable Long id) throws ServiceException {
        return service.queryDetailSubmitMessageById(id);
    }

    @GetMapping("/task_status/{id}")
    @ApiOperation(value = "根据ID查询任务状态接口")
    public ResultModel queryTaskStatusById(@PathVariable Long id) throws ServiceException {
        return service.queryTaskStatusById(id);
    }

    @GetMapping("/operate_history/{id}")
    @ApiOperation(value = "根据ID查询任务操作历史接口")
    public ResultModel queryOperateHistoryById(@PathVariable Long id) throws ServiceException {
        return service.queryOperateHistoryById(id);
    }

}